home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 09, No. 12 (1988-12)(MicroSPARC)(Side A)[a].zip
/
Nibble Volume 09, No. 12 (1988-12)(MicroSPARC)(Side A)[a].po
/
ARTIST.T.txt
< prev
next >
Wrap
Text File
|
1996-12-24
|
10KB
|
388 lines
**************************************************
* *
* ARTIST Source Code *
* *
* by S. Scott Zimmerman *
* Copyright (c) 1988 *
* by MicroSPARC, Inc *
* Concord, MA 01742 *
* *
* The MicroSPARC Assembler *
* *
**************************************************
ORG $8000 ;Decimal 32768
**************************************************
* EQUates: *
**************************************************
XALT EQU $04 ;Altern X position
SCRNNUM EQU $06 ;Scrn num for HRCOMP
LENGTH EQU $08 ;Length of compact pict
CH EQU $24 ;Cursor horizontal
COMPTR EQU $1E ;Compact start
XPOS EQU $CE ;Cursor X position
YALT EQU $E3 ;Altern Y position
YPOS EQU $FA ;Cursor Y position
FLSHDEL EQU $FB ;Flash delay
MSGPTR EQU $FE ;Message pointer
HREXP EQU $300 ;Expander routine
APLSOFT EQU $3D0 ;Aplsoft warm start
COMPIC EQU $4000 ;Compressed picture
HRCOMP EQU $6000 ;Compactor routine
KEYBD EQU $C000 ;Keyboard input
STROBE EQU $C010 ;Clear keyboard strobe
XDRAW EQU $F65D ;XOR shape onto scrn
PRNTAX EQU $F941 ;Print hex number
SETTXT EQU $FB39 ;Set text mode
TABV EQU $FB5B ;Vertical tab routine
HOME EQU $FC58 ;Clear text screen
CROUT EQU $FD8E ;Output carriage return
COUT EQU $FDED ;Output a character
*------------------------------------------------*
ESC EQU $9B ;Escape code
LARR EQU $88 ;Left arrow code
DARR EQU $8A ;Down arrow code
UARR EQU $8B ;Up arrow code
RARR EQU $95 ;Right arrow code
DELVAL EQU $2000 ;Delay value
**************************************************
* Hi-Res Graphics ROM routines and switches: *
**************************************************
ROT EQU $F9 ;Shape rotation
HPAG EQU $E6 ;Hi-Res page ($20/$32)
SCALE EQU $E7 ;Shape scale
SHOW EQU $C050 ;Display graphics scrn
FULLSCRN EQU $C052 ;Display full scrn
MXEDSCRN EQU $C053 ;Display mixed gr/txt
FLIP1 EQU $C054 ;Display screen #1
HRSCRN EQU $C057 ;Display Hi-Res gr
HCLR EQU $F3F2 ;Clear Hi-Res screen
HPOSN EQU $F411 ;Position HR cursor
HPLOT EQU $F457 ;Plot a pixel
HLIN EQU $F53A ;Draw a line
SETHCOL EQU $F6EC ;Set HR color
**************************************************
* Initialize: *
**************************************************
LDA #0 ;Set things to zero
STA XALT ;Alt cursor
STA XALT+1
STA YALT
STA CURSFLG ;Init cursor flag
STA ROT ;Set rotation to 0
STA SCRNNUM ;Set to page 1
STA PENFLG ;Set to pen up
STA FMFLG ;Set to mixed
STA XPOS+1 ;Clear HOB of X pos
STA LENGTH ;Init to no length
STA LENGTH+1
LDA #140 ;Set main cursor pos
STA XPOS
LDA #96 ;Set Y position
STA YPOS
LDX #3 ;Set color to white
JSR SETHCOL ;Call to set color
LDA #1 ;Set the scale to 1
STA SCALE
LDA #$20 ;Set HR page 1
STA HPAG
JSR HCLR ;Clear HR screen
JSR HOME ;Clear text scrn
JSR PRNTMENU ;Print menu
BIT HRSCRN ;Select hi-res screen
BIT FLIP1 ;Make sure it's pg 1
BIT MXEDSCRN ;Set to mixed scrn
BIT SHOW ;Show HR screen
BIT STROBE ;Clear kb strobe
JSR PLOTCURS ;Plot the cursor
**************************************************
* Start ARTIST main loop: *
**************************************************
MAINLOOP BIT KEYBD ;Keypressed?
BMI GETKEY ;Yes, get key
JMP NOHIT ;No, proceed
GETKEY LDA KEYBD ;Get key
BIT STROBE ;Clear keybd strobe
PHA ;Save keyboard input
LDA CURSFLG ;Is flag on?
BEQ CHECKIN ;No, just check input
JSR PLOTCURS ;Yes, erase cursors
CHECKIN PLA ;Restore input
CMP #RARR ;Right arrow?
BNE NEXT1 ;No, check next
INC XPOS ;Move right a pixel
BNE ]A
INC XPOS+1
]A LDA XPOS ;Is it too high?
CMP #280 ;Past 279?
LDA XPOS+1
SBC #280/
BCC SETNEW ;No, just set new
LDA #0 ;Yes, wrap back to 0
STA XPOS
STA XPOS+1
SETNEW JSR PLOT ;If pen down, plot point
JSR PLOTCURS ;Go turn cursor on
JMP MAINLOOP
NEXT1 CMP #LARR ;Left arrow?
BNE NEXT2 ;No, check next
LDA XPOS ;Is it at zero?
ORA XPOS+1
BNE ]A ;No, so decrement
LDA #279 ;Yes, so wrap
STA XPOS
LDA #279/
STA XPOS+1
BNE SETNEW ;Always
]A LDA XPOS ;Decrement X
BNE ]B
DEC XPOS+1
]B DEC XPOS
JMP SETNEW ;Go set new pos
NEXT2 CMP #UARR ;Up arrow?
BNE NEXT3 ;No, check next
LDA YPOS ;Is it at zero?
BNE ]A ;No, so decrement
LDA #191 ;Yes, so wrap
STA YPOS
JMP SETNEW ;Go set new pos
]A DEC YPOS ;Decrement Y
JMP SETNEW ;Go set new pos
NEXT3 CMP #DARR ;Down arrow?
BNE NEXT4 ;No, check next
INC YPOS ;Go down one pixel
LDA YPOS ;Get current value
CMP #192 ;Is it past bottom?
BNE OKAY ;No, it's okay
LDA #0 ;Yes, set to top
STA YPOS
OKAY JMP SETNEW ;Go set new pos
NEXT4 CMP #"0 ;Input a number?
BCC NEXT5 ;Too low
CMP #"8 ;Is it too high?
BCS NORMKEY ;Yes, go check next
SEC ;Prepare to subtract
SBC #"0 ;Subtract ASCII for 0
TAX ;Put color in X
JSR SETHCOL ;Set new color
JMP MAINLOOP
NEXT5 CMP #ESC ;Undo last screen
BNE NORMKEY ;No, proceed
JSR RESTORE ;Restore from save
JMP MAINLOOP
NORMKEY AND #%11011111 ;Conv lower->upper
CMP #"I ;Aux cursor up?
BNE CHKJ ;No, go check J
LDA YALT ;Is it at zero?
BNE ]A ;No, so decrement
LDA #191 ;Yes, so wrap
STA YALT
JMP SETNEW ;Go set new pos
]A DEC YALT ;Decrement Y
JMP SETNEW ;Go set new pos
CHKJ CMP #"J ;Aux cursor left?
BNE CHKK ;No, go check K
LDA XALT ;Is it at zero?
ORA XALT+1
BNE ]A ;No, so decrement
LDA #279 ;Yes, so wrap
STA XALT
LDA #279/
STA XALT+1
BNE OKAY ;Always
]A LDA XALT ;Decrement X
BNE ]B
DEC XALT+1
]B DEC XALT
JMP SETNEW ;Go set new pos
CHKK CMP #"K ;Aux cursor right?
BNE CHKM ;No, go check M
INC XALT ;Move right a pixel
BNE ]A
INC XALT+1
]A LDA XALT ;Is it too high?
CMP #280 ;Past 279?
LDA XALT+1
SBC #280/
BCC OK ;No, just set new
LDA #0 ;Yes, wrap back to 0
STA XALT
STA XALT+1
BEQ OK ;Always branch
CHKM CMP #"M ;Aux cursor down?
BNE CHKF ;No, go check F
INC YALT ;Go down one pixel
LDA YALT ;Get current value
CMP #192 ;Is it past bottom?
BNE OK ;No, it's okay
LDA #0 ;Yes, set to top
STA YALT
OK JMP SETNEW ;Go set new pos
CHKF CMP #"F ;Full/mixed toggle?
BNE CHKL ;No, go check L
LDA FMFLG ;Get full/mixed flag
EOR #1 ;Toggle it
STA FMFLG ;Save result
BNE SETFULL ;Go set to full
BIT MXEDSCRN ;Set to mixed
JMP MAINLOOP
SETFULL BIT FULLSCRN ;Set to full
JMP MAINLOOP
CHKL CMP #"L ;Draw line?
BNE CHKC ;No, go check C
JSR SAVE ;Save current screen
LDY XPOS+1 ;Get cursor position
LDX XPOS
LDA YPOS
JSR HPOSN ;Set that position
LDX XALT+1 ;Get alt cursor pos
LDA XALT
LDY YALT
JSR HLIN ;Draw a line
JMP MAINLOOP
CHKC CMP #"C ;Clear screen?
BNE CHKP ;No, go check P
JSR SAVE ;Save current screen
JSR HCLR ;Clear graphics scrn
JMP MAINLOOP
CHKP CMP #"P ;Toggle pen up/down?
BNE CHKQ ;No, go check Q
JSR SAVE ;Save current screen
LDA PENFLG ;Get current setting
EOR #1 ;Toggle 0 <--> 1
STA PENFLG
JMP MAINLOOP
CHKQ CMP #"Q ;Quit?
BEQ QUIT ;Yes
NOHIT INC FLSHDEL ;Increment delay
BNE ]A
INC FLSHDEL+1
]A LDA FLSHDEL ;End of flash delay?
CMP #DELVAL
LDA FLSHDEL+1
SBC #DELVAL/
BCS BLINK ;Yes, blink cursor
JMP MAINLOOP
BLINK JSR PLOTCURS
JMP MAINLOOP
*------------------------------------------------*
QUIT JSR SAVE ;Save the HR screen
JSR SETTXT ;Set back to text mode
JSR HOME ;Clear the text screen
LDX #ADRMSG ;Print address message
LDY #ADRMSG/
JSR MESSAGE
LDA #COMPIC/ ;Get compact address
LDX #COMPIC
JSR PRNTAX
LDX #LENMSG
LDY #LENMSG/
JSR MESSAGE
LDA LENGTH+1 ;Get compact length
LDX LENGTH
JSR PRNTAX ;Print hex value
JSR CROUT ;Carriage return
JMP APLSOFT
**************************************************
* Auxiliary routines: *
**************************************************
PLOTCURS LDA CURSFLG ;Get current flag
EOR #1 ;Toggle 1 <--> 0
STA CURSFLG
LDY XPOS+1 ;Set X location
LDX XPOS
LDA YPOS ;Set Y location
JSR HPOSN ;Set its position
LDA #0 ;Zero rotation
LDY #CURSOR/ ;Set shape location
LDX #CURSOR
JSR XDRAW ;Draw the shape
LDY XALT+1 ;Set X location
LDX XALT
LDA YALT ;Set Y location
JSR HPOSN ;Set its position
LDA #0 ;Zero rotation
LDY #ALTCURS/ ;Set shape location
LDX #ALTCURS
JSR XDRAW ;Draw the shape
LDA #0 ;Zero the flash delay
STA FLSHDEL
STA FLSHDEL+1
RTS
*------------------------------------------------*
PLOT LDA PENFLG ;Is pen on?
BNE ON ;Yes, so plot
RTS ;No, so just return
ON LDY XPOS+1 ;Set location
LDX XPOS
LDA YPOS
JMP HPLOT ;Plot the point, return
*------------------------------------------------*
PRNTMENU LDX #0
STX CH ;Set horiz location
LDA #20 ;Set verical location
JSR TABV ;Move cursor there
LDX #MENUMSG ;Get message address
LDY #MENUMSG/
MESSAGE STX MSGPTR ;Set message pointer
STY MSGPTR+1
LDY #0 ;Init index
MSGLOOP LDA (MSGPTR),Y ;Get character
BEQ MSGEND ;Quit if zero
JSR COUT ;Print character
INY ;Go to next
BNE MSGLOOP ;Always branch
MSGEND RTS ;End of message
*------------------------------------------------*
SAVE LDA #COMPIC ;Set address of compact
STA COMPTR
LDA #COMPIC/
STA COMPTR+1
JSR HRCOMP
RTS
*------------------------------------------------*
RESTORE LDA LENGTH ;Is a compact pict there?
ORA LENGTH+1
BNE RES ;Yes, restore it
RTS ;No, just return
RES JSR HCLR ;Clear current screen
LDA #COMPIC ;Set compact pict adrs
STA COMPTR
LDA #COMPIC/
STA COMPTR+1
JSR HREXP
RTS
**************************************************
* Data: *
**************************************************
MENUMSG ASC "ESC=UNDO 0-7=COLOR F=FULL/MXED"
ASC " L=LINE"
ASC "C=CLEAR SCREEN Q=QUIT "
ASC "P=PEN UP/DOWN"
ASC "IJKM=MOVE ALT CURSOR "
ASC "ARROWS=MOVE CURSOR"
BRK
ADRMSG ASC "COMPACT PICT: A$"
BRK
LENMSG ASC ",L$"
BRK
*------------------------------------------------*
CURSFLG DFS 1 ;0=Cursor off, 1=on
PENFLG DFS 1 ;0=Pen up, 1=down
FMFLG DFS 1 ;0=Mixed, 1=full
*------------------------------------------------*
CURSOR DFC $3A,$24,$2D,$36,$07,$00
ALTCURS DFC $04,$00